package models

import (
	"encoding/json"
	"time"
)

type AlertRule struct {
	TenantID    string
	MetricName  string
	Threshold   float64
	Condition   string        `json:"condition"` // 例如 ">", "<"
	Duration    time.Duration `json:"duration"`
	NotifyUsers []string      `json:"notify_users"`
}

// ToJSON 序列化为JSON字符串
func (r *AlertRule) ToJSON() string {
	jsonData, _ := json.Marshal(r)
	return string(jsonData)
}
